package com.lsk.interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Bean
     public JWTInterceptor getJwtInterceptor(){
        JWTInterceptor jwtInterceptor =  new JWTInterceptor();
        return jwtInterceptor;
    }


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getJwtInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/verification-code-check")
                .excludePathPatterns("/verification-code")
                .excludePathPatterns("/token-refresh")
                .excludePathPatterns("/forecast-price")
                .excludePathPatterns("/NoAuth");
    }
}
